const express = require('express');
const router = express.Router();

router.get('/forCurrentUser', (req, res) => {
    const content = [];
    const {pageIndex, pageSize} = req.query;
    for(let i = 0; i < 10; i++)
        content.push({
            id: `2019${i}`,
            code: `JSJS-2019-${i}`,
            dealerCode: `JXS-${i}`,
            technologyActivityName: '技术升级',
            brandCode: 'Chery',
            brandName: '奇瑞',
            laborFee: 100,
            materialFee: 200,
            mgmtFee: 300,
            assistantFee: 400,
            totalFee: 1000,
            status: 1,
            currency: 1,
            createTime: '2019-09-12T11:27:39.715Z',
            approveTime: '2019-09-12T11:27:39.715Z',
            rowVersion: 'string',
            options: ['update', 'abandon', 'submit', 'approve', 'reSettlement', 'export'],
        });
    res.json({
        message: '',
        payload: {
            content,
            pageIndex: parseInt(pageIndex, 10),
            pageSize: parseInt(pageSize, 10),
            totalElements: 50
        }
    });
});
router.post('/', (req, res) => {
    res.json({
        message: '新增'
    });
});
router.put('/:id', (req, res) => {
    res.json({
        message: '编辑'
    });
});
router.put('/:id/submit', (req, res) => {
    res.json({
        message: '提交'
    });
});
router.put('/:id/pass', (req, res) => {
    res.json({
        message: '审核通过'
    });
});
router.put('/:id/reject', (req, res) => {
    res.json({
        message: '驳回'
    });
});
router.put('/:id/reSettlement', (req, res) => {
    res.json({
        message: '反结算'
    });
});
router.put('/:id/abandon', (req, res) => {
    res.json({
        message: '作废'
    });
});
router.get('/export/forCurrentUser', (req, res) => {
    res.json({
        message: '导出成功'
    });
});
router.get('/:id', (req, res) => {
    res.json({
        message: 'ok',
        payload: {
            id: '1',
            code: 'WXSP2019082700-1',
            technologyActivityName: '技术升级',
            dealerId: 'string',
            dealerCode: 'string',
            dealerName: 'string',
            brandId: 'string',
            brandCode: 'Chery',
            brandName: '奇瑞',
            laborFee: 100,
            materialFee: 200,
            mgmtFee: 300,
            assistantFee: 400,
            totalFee: 1000,
            status: 1,
            currency: 1,
            createTime: '2019-09-12T11:27:39.715Z',
            approveTime: '2019-09-12T11:27:39.715Z',
            rowVersion: 'string',
            options: ['update', 'abandon', 'submit', 'approve', 'reSettlement', 'export'],
            startTime: '2020-05-06T02:00:27.687Z',
            endTime: '2020-05-06T02:00:27.687Z',
            approverName: 'string',
            approveComment: 'string',
            remark: 'string',
            details: [
                {
                    technologyActivityClaimId: 'string1',
                    technologyActivityClaimCode: 'string1',
                    laborFee: 10,
                    materialFee: 20,
                    mgmtFee: 30,
                    assistantFee: 40,
                    totalFee: 50,
                    settlementDetails: [
                        {
                            id: 'string1',
                            vin: 'string1',
                            engineCode: 'string1',
                            saleDate: '2020-05-06T02:00:27.687Z',
                            mileage: 10,
                            labourType: 20,
                            laborFee: 30,
                            materialFee: 40,
                            mgmtFee: 50,
                            assistantFee: 60,
                            totalFee: 70
                        },
                        {
                            id: 'string2',
                            vin: 'string2',
                            engineCode: 'string2',
                            saleDate: '2020-05-06T02:00:27.687Z',
                            mileage: 10,
                            labourType: 20,
                            laborFee: 30,
                            materialFee: 40,
                            mgmtFee: 50,
                            assistantFee: 60,
                            totalFee: 70
                        },
                        {
                            id: 'string3',
                            vin: 'string43',
                            engineCode: 'string3',
                            saleDate: '2020-05-06T02:00:27.687Z',
                            mileage: 10,
                            labourType: 20,
                            laborFee: 30,
                            materialFee: 40,
                            mgmtFee: 50,
                            assistantFee: 60,
                            totalFee: 70
                        },
                    ]
                },
                {
                    technologyActivityClaimId: 'string2',
                    technologyActivityClaimCode: 'string2',
                    laborFee: 10,
                    materialFee: 20,
                    mgmtFee: 30,
                    assistantFee: 40,
                    totalFee: 50,
                    settlementDetails: [
                        {
                            id: 'string1',
                            vin: 'string1',
                            engineCode: 'string1',
                            saleDate: '2020-05-06T02:00:27.687Z',
                            mileage: 10,
                            labourType: 20,
                            laborFee: 30,
                            materialFee: 40,
                            mgmtFee: 50,
                            assistantFee: 60,
                            totalFee: 70
                        },
                        {
                            id: 'string2',
                            vin: 'string2',
                            engineCode: 'string2',
                            saleDate: '2020-05-06T02:00:27.687Z',
                            mileage: 10,
                            labourType: 20,
                            laborFee: 30,
                            materialFee: 40,
                            mgmtFee: 50,
                            assistantFee: 60,
                            totalFee: 70
                        },
                        {
                            id: 'string3',
                            vin: 'string43',
                            engineCode: 'string3',
                            saleDate: '2020-05-06T02:00:27.687Z',
                            mileage: 10,
                            labourType: 20,
                            laborFee: 30,
                            materialFee: 40,
                            mgmtFee: 50,
                            assistantFee: 60,
                            totalFee: 70
                        },
                    ]
                }
            ],
        }
    });
});
module.exports = router;
